home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- proc setOptionVars (int $forceFactorySettings)
- {
- if ($forceFactorySettings || !`optionVar -exists polyCopyUVSet`)
- optionVar -stringValue polyCopyUVSet "uvSet";
- }
-
- global proc performCopyCurrentUVSetSetup (string $parent,
- int $forceFactorySettings)
- {
- setOptionVars($forceFactorySettings);
- setParent $parent;
-
- string $sval;
- $sval = `optionVar -query polyCopyUVSet`;
- textFieldGrp -edit -tx $sval polyCopyUVSet;
- }
-
- global proc performCopyCurrentUVSetCallback (string $parent, int $doIt, string $selectCmd)
- {
- setParent $parent;
-
- optionVar -stringValue polyCopyUVSet
- `textFieldGrp -query -tx polyCopyUVSet`;
-
- if ($doIt) {
- string $cmd = ("performCopyCurrentUVSet \"1\" {\"0\", \"" + $selectCmd + "\", \"0\"} \"\"");
- eval ($cmd);
- addToRecentCommandQueue $cmd "copyCurrentUVSet";
- }
- }
-
- proc polyCopyCurrentUVSetOptions(string $selectCmd)
- {
- string $commandName = "performCopyCurrentUVSet";
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- string $layout = getOptionBox();
- setParent $layout;
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
-
- string $parent = `columnLayout -adjustableColumn true`;
-
- textFieldGrp -label "UV Set Name to Copy to: " polyCopyUVSet;
-
- setParent $parent;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit -label "Apply and Close"
- -command ($callback + " " + $parent + " " + 1 + " \"" + $selectCmd + "\"")
- $applyBtn;
-
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + " \"" + $selectCmd + "\"" + "; hideOptionBox")
- $saveBtn;
-
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- setOptionBoxTitle("Copy Current UV Set Options");
-
- setOptionBoxHelpTag( "CopyCurrentUVSet" );
-
- eval (($setup + " " + $parent + " " + 0));
- showOptionBox();
- }
-
- global proc string performCopyCurrentUVSet
- (string $version, string $args[], string $uvSetName)
- //
- // Input Arguments:
- // $version: The version of this option box. Used to know how to
- // interpret the $args array.
- // "1" : $action, $selectCmd
- //
- // $args
- // Version 1
- // [0] $action 0 : Execute the command.
- // 1 : Show the option box dialog.
- // 2 : Return the command.
- // [1] $selectCmd The command to issue to determine which objects
- // to affect
- // [2] $forceCreate Whether or not to force creation of a new UV set
- //
- // Return Value:
- // The string to execute for this option box.
- //
- {
- int $versionNum = $version;
-
- int $action = $args[0];
- string $selectCmd = $args[1];
- int $forceCreate = $args[2];
-
- string $cmd="polyUVSet -copy -newUVSet ";
- switch ($action)
- {
- case 1: polyCopyCurrentUVSetOptions $selectCmd;
- // Just the option box
- break;
-
- case 0:
- case 2:
- setOptionVars(false);
- string $name = `optionVar -query polyCopyUVSet`;
- if ($forceCreate) $name = $uvSetName;
-
- if (size($name))
- {
- $cmd = ("{string $objects[] = `" + $selectCmd + "`;" + $cmd);
- $cmd += ("\"" + $name + "\" $objects;}");
- if ($action == 0) {
- evalEcho $cmd;
- }
- }
- else
- {
- if ($action == 0)
- warning "No name specified to copy uvset with.";
- }
- break;
- }
- return $cmd;
- }
-